package com.yuandian.management.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuandian.api.management.entity.ConfResourceBlacklist;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.management.enums.BlackListType;
import com.yuandian.management.mapper.ConfResourceBlacklistMapper;
import com.yuandian.management.service.ConfResourceBlacklistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * 服务资源黑名单配置表-Service实现
 * @author zfsn
 * @date 2023-3-15
 */
@Service
public class ConfResourceBlacklistServiceImpl extends ServiceImpl<ConfResourceBlacklistMapper, ConfResourceBlacklist>
		implements ConfResourceBlacklistService {

	@Autowired
	private ConfResourceBlacklistMapper confResourceBlacklistMapper;


	@Override
	public boolean updateById(ConfResourceBlacklist confResourceBlacklist) {
		return confResourceBlacklistMapper.updateByID(confResourceBlacklist) >= 0;
	}

	/**
	 * 新增数据
	 *
	 * @param confResourceBlacklist 实例对象
	 * @return 通用返回对象
	 */
	@Override
	public boolean save(ConfResourceBlacklist confResourceBlacklist) {
		return confResourceBlacklistMapper.save(confResourceBlacklist) >= 0;
	}

	@Override
	public List<ConfResourceBlacklist> listByIds(Collection<? extends Serializable> idList) {
		return confResourceBlacklistMapper.listByIds(idList);
	}

	/**
	 * 分页查询
	 *
	 * @param confResourceBlacklist 筛选条件
	 * @return 通用返回对象
	 */
	@Override
	public Page<ConfResourceBlacklist> listPage(ConfResourceBlacklist confResourceBlacklist) {
		confResourceBlacklist.setType(BlackListType.RESOURCE_FILTER_TYPE);
		return confResourceBlacklistMapper.listPage(new Page<>(confResourceBlacklist.getPageNum(), confResourceBlacklist.getPageSize()), confResourceBlacklist);
	}

	/**
	 * 新增数据
	 *
	 * @param confResourceBlacklist 筛选条件
	 * @return 通用返回对象
	 */
	@Override
	public R<String> saveConfig(ConfResourceBlacklist confResourceBlacklist) {

		return R.ok();
	}

	@Override
	public R<String> deleteById(Integer id) {
		return null;
	}


}